package com.zidongxiangxi.rabbit.starter.entity.consumer;

/**
 * 幂等消费配置
 *
 * @author chenxudong
 * @date 2020/11/08
 */
public class ReliableRabbitConsumerIdempotent {
	/**
	 * 是否开启幂等消费
	 */
	private boolean enabled = false;

	/**
	 * 是否事务性幂等
	 */
	private boolean transaction = false;

	/**
	 * 消费记录的表名
	 */
	private String tableName = "consume_record";

	/**
	 * 是否开启清理消费记录
	 */
	private boolean autoClear = false;

	/**
	 * 保留时长，单位：天
	 */
	private int retentionPeriod = 30;

	/**
	 * 每次定时任务清理的消费记录数量
	 */
	private int clearBatchSize = 20;

	/**
	 * 执行清理任务的周期，单位毫秒，默认300000
	 */
	private long workPeriod = 300000;

	/**
	 * 顺序消费配置
	 */
	private final ReliableRabbitConsumerSequence sequence = new ReliableRabbitConsumerSequence();

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public boolean isTransaction() {
		return transaction;
	}

	public void setTransaction(boolean transaction) {
		this.transaction = transaction;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public boolean isAutoClear() {
		return autoClear;
	}

	public void setAutoClear(boolean autoClear) {
		this.autoClear = autoClear;
	}

	public int getRetentionPeriod() {
		return retentionPeriod;
	}

	public void setRetentionPeriod(int retentionPeriod) {
		this.retentionPeriod = retentionPeriod;
	}

	public int getClearBatchSize() {
		return clearBatchSize;
	}

	public void setClearBatchSize(int clearBatchSize) {
		this.clearBatchSize = clearBatchSize;
	}

	public long getWorkPeriod() {
		return workPeriod;
	}

	public void setWorkPeriod(long workPeriod) {
		this.workPeriod = workPeriod;
	}

	public ReliableRabbitConsumerSequence getSequence() {
		return sequence;
	}
}
